package net.cyndeline.rldungeon.dgs

import net.cyndeline.rlgraph.util.{ EdgeCopyFactory => RLGraphFactory }
import net.cyndeline.rldungeon.dgs.graph.{DGSFunctionality, Room}
import scalax.collection.GraphEdge.UnDiEdge
import scalax.collection.GraphPredef.OuterEdge

/**
 * Creates a graph edge based on another edge by copying all data except vertex values.
 */
trait EdgeCopyFactory[VType <: Room[VType], EType[X] <: UnDiEdge[X] with DGSFunctionality[X, EType]] extends RLGraphFactory[VType, EType] {

  /**
   * Copies an edge and assigns the copy new vertices.
   *
   * @param edge Old edge to copy.
   * @param a A vertex to assign the new edge in the position _1.
   * @param b A vertex to assign the new edge in the position _2.
   * @return a copy of the old edge but with new vertices assigned. Feeding the same triple (edge, a, b) into the
   *         factory multiple times should result in equal edges being produced.
   */
  def copyEdge(edge: EType[VType], a: VType, b: VType): EType[VType] with OuterEdge[VType, EType]
}
